package com.dkd.manage.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.dkd.common.annotation.Log;
import com.dkd.common.core.controller.BaseController;
import com.dkd.common.core.domain.AjaxResult;
import com.dkd.common.enums.BusinessType;
import com.dkd.manage.domain.Logisticsdelivery;
import com.dkd.manage.service.ILogisticsdeliveryService;
import com.dkd.common.utils.poi.ExcelUtil;
import com.dkd.common.core.page.TableDataInfo;

/**
 * 物流公司配送信息Controller
 * 
 * @author yuwensheng
 * @date 2024-10-26
 */
@RestController
@RequestMapping("/manage/logisticsdelivery")
public class LogisticsdeliveryController extends BaseController
{
    @Autowired
    private ILogisticsdeliveryService logisticsdeliveryService;

    /**
     * 查询物流公司配送信息列表
     */
    @PreAuthorize("@ss.hasPermi('manage:logisticsdelivery:list')")
    @GetMapping("/list")
    public TableDataInfo list(Logisticsdelivery logisticsdelivery)
    {
        startPage();
        List<Logisticsdelivery> list = logisticsdeliveryService.selectLogisticsdeliveryList(logisticsdelivery);
        return getDataTable(list);
    }

    /**
     * 导出物流公司配送信息列表
     */
    @PreAuthorize("@ss.hasPermi('manage:logisticsdelivery:export')")
    @Log(title = "物流公司配送信息", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, Logisticsdelivery logisticsdelivery)
    {
        List<Logisticsdelivery> list = logisticsdeliveryService.selectLogisticsdeliveryList(logisticsdelivery);
        ExcelUtil<Logisticsdelivery> util = new ExcelUtil<Logisticsdelivery>(Logisticsdelivery.class);
        util.exportExcel(response, list, "物流公司配送信息数据");
    }

    /**
     * 获取物流公司配送信息详细信息
     */
    @PreAuthorize("@ss.hasPermi('manage:logisticsdelivery:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(logisticsdeliveryService.selectLogisticsdeliveryById(id));
    }

    /**
     * 新增物流公司配送信息
     */
    @PreAuthorize("@ss.hasPermi('manage:logisticsdelivery:add')")
    @Log(title = "物流公司配送信息", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody Logisticsdelivery logisticsdelivery)
    {
        return toAjax(logisticsdeliveryService.insertLogisticsdelivery(logisticsdelivery));
    }

    /**
     * 修改物流公司配送信息
     */
    @PreAuthorize("@ss.hasPermi('manage:logisticsdelivery:edit')")
    @Log(title = "物流公司配送信息", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody Logisticsdelivery logisticsdelivery)
    {
        return toAjax(logisticsdeliveryService.updateLogisticsdelivery(logisticsdelivery));
    }

    /**
     * 删除物流公司配送信息
     */
    @PreAuthorize("@ss.hasPermi('manage:logisticsdelivery:remove')")
    @Log(title = "物流公司配送信息", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(logisticsdeliveryService.deleteLogisticsdeliveryByIds(ids));
    }
}
